Ext.define('Admin.toolbar.Toolbar', {
	        override : 'Ext.toolbar.Toolbar',

	        contain : function(userRoles, roles) {
		        for (var i in userRoles) {
			        for (var j in roles) {
				        if (userRoles[i] === roles[j].name) {
					        return true;
				        }
			        }
		        }
		        return false;
	        },

	        onRender4Role : function(me, eOpts) {
		        var app = Admin && Admin.getApplication && Admin.getApplication();
		        var view = app && app.getMainView();
		        if (view) {
			        var user = view.getViewModel().get('user');
			        var items = me.items.items, i, len = items.length;
			        for (i = 0; i < len; i++) {
				        var item = items[i], roles = item.config.roles;
				        if (roles && !Ext.isArray(roles)) {
					        roles = [roles];
				        }
				        if (roles && item.isXType('button')) {
					        item.setHidden(!me.contain(user.roles, roles));
				        } else if (roles && item.isXType('form')) {
					        var formItem = item.items.items;
					        formItem[0] && formItem[0].isXType('filefield')
					                && formItem[0].setHidden(!me.contain(user.roles, roles))
				        }
			        }
		        }
	        },

	        initComponent : function() { // 不能用listerns，会被覆盖
		        var me = this;
		        me.callParent(arguments);
		        me.on('render', me.onRender4Role, me);
	        }

        });